﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyArticle_json.aspx.cs" Inherits="newBlog.CenterInc.view_json.MyArticle_json" %>

<%@ Import Namespace="newBlog.CenterInc.model" %>
<%@ Import Namespace="newBlog.CenterInc.Ctrltor" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>

<%  Response.ContentType = "application/json";
    if (Session["user_id"]==null) {
        Response.Write("{\"error\":\"您未登录本站\"}");
        return;
    }
    string user_id = Session["user_id"].ToString();
    int page = Request.QueryString["page"]==null?0:(Convert.ToInt32(Request.QueryString["page"])-1)*20;
    string maxPrice = Request.QueryString["maxPrice"]==null||Request.QueryString["maxPrice"].Length==0?"":Request.QueryString["maxPrice"];
    string minPrice = Request.QueryString["minPrice"]==null||Request.QueryString["minPrice"].Length==0?"":Request.QueryString["minPrice"];
    string minTime = Request.QueryString["minTime"] == null||Request.QueryString["minTime"].Length==0? "":Request.QueryString["minTime"];
    string maxTime = Request.QueryString["maxTime"] == null||Request.QueryString["maxTime"].Length==0? "":Request.QueryString["maxTime"];
    string catalog = Request.QueryString["catalog"] == null||Request.QueryString["catalog"].Length==0? "":Request.QueryString["catalog"];
    string title = Request.QueryString["search"] == null||Request.QueryString["search"].Length==0? "" : Request.QueryString["search"];
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    Article_inc article_Inc = new Article_inc();
    List<MyArticle_itemDao_json> list = article_Inc.myArticle_ItemDao_Jsons(Session["user_id"].ToString(),page,minPrice,maxPrice,minTime,maxTime,catalog,title);
    int count = article_Inc.MyarticleCount(user_id,minPrice,maxPrice,minTime,maxTime,catalog,title);
    string json = "{\"code\":0,\"msg\":\"\",\"count\":"+count+",\"data\":"+serializer.Serialize(list)+"}";
    Response.Write(json);

    %>